package com.tianya.common.feign;

import com.tianya.common.constant.ServiceNameConstants;
import com.tianya.common.model.LoginAppUser;
import com.tianya.common.model.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(name = ServiceNameConstants.USER_SERVICE)
public interface UserService {

    /**
     * feign rpc远程调用
     * 查询用户实体对象
     * @param username
     * @return
     */
    @GetMapping(value = "/users/name/{username}")
    SysUser selectByUserName(@PathVariable("username") String username);

    /**
     * feign rpc调用
     * @param username
     * @return
     */
    @GetMapping(value = "/users-anon/login/{username}")
    LoginAppUser findByUsername(@PathVariable("username") String username);

    /**
     * 远程调用，通过手机号查询用户、角色信息
     * @param mobile
     * @return
     */
    @GetMapping(value = "/users-anon/mobile/{mobile}")
    LoginAppUser findByMobile(@PathVariable("mobile") String mobile);

    /**
     * 根据openId查询用户信息
     * @param openId
     * @return
     */
    @GetMapping(value = "/users-anou/openId/{openId}")
    LoginAppUser findByOpenId(@PathVariable("openId") String openId);
}
